<template>
  <div>
    <el-form
      ref="form"
      :model="form"
      label-width="80px"
      label-position="right"
      :inline="true"
    >
      <el-form-item
        v-for="item in formParams.formData"
        :key="item.model"
        :label="item.labelName"
      >
        <el-input
          v-if="item.type === 'text'"
          v-model="form[item.model]"
        ></el-input>
        <el-select
          v-if="item.type === 'select'"
          v-model="form[item.model]"
          placeholder="请选择"
        >
          <el-option
            v-for="optionItem in item.options"
            :key="optionItem.value"
            :label="optionItem.labelName"
            :value="optionItem.value"
          ></el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <el-button type="primary" @click="handleSubmit">submit go</el-button>
  </div>
</template>

<script>
export default {
  props: {
    formParams: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      form: {}
    }
  },
  methods: {
    handleSubmit() {
      this.$toast.show('hello world')
      console.log(this.form)
    }
  }
}
</script>

<style></style>
